﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using BlueCMS.Core.Data.Query.Columns;

namespace BlueCMS.Core.Data.Query.Clauses
{
    public class OrderByClause : IOrderByClause
    {
        public List<OrderByColumn> OrderByColumns { get; private set; }

        public OrderByClause()
        {
            OrderByColumns = new List<OrderByColumn>();
        }

        IOrderByColumn IOrderByClause.Column(string name)
        {
            OrderByColumn column = new OrderByColumn(name, OrderByType.Column, this);
            OrderByColumns.Add(column);
            return column;
        }

        IOrderByColumn IOrderByClause.Alias(string alias)
        {
            OrderByColumn column = new OrderByColumn(alias, OrderByType.Alias, this);
            OrderByColumns.Add(column);
            return column;
        }

        IOrderByColumn IOrderByClause.Index(int index)
        {
            OrderByColumn column = new OrderByColumn(index, OrderByType.Index, this);
            OrderByColumns.Add(column);
            return column;
        }
    }
}
